{extend name="public/base" /}
{block name="head"}
	<style type="text/css">
		form{width: 800px;}
		.layui-form-selected{z-index: 9999;}
	</style>
{/block}
{block name="body"}
<div id="fuyun-app" class="fuyun-app">
  <div class="fuyun-title">
    <h5>添加数据</h5>
    <a href="{:Url('index')}" class="layui-btn fuyun-add-btn layui-btn-small layui-btn-normal"><i class="fa fa-plus-square margin-right-5"></i>返回</a>
  </div>
  <div class="content-box">

		<form class="layui-form padding-10" method="post" action="{:Url('update')}">
			<div class="left-box">
				
				<div class="layui-form-item">
					<label class="layui-form-label">标识</label>
					<div class="layui-input-inline">
						<input type="text" name="config_key" placeholder="请输入密码" class="layui-input" value="{$ConfigModel['config_key']}">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">时间</label>
					<div class="layui-input-block">
						<input class="layui-input" name="text" onclick="layui.laydate({elem: this, festival: true, format: 'YYYY-MM-DD hh:mm:ss'})">
					</div>
				</div>

				<div class="layui-form-item">
					<label class="layui-form-label">备注</label>
					<div class="layui-input-inline">
						<textarea name="remark" placeholder="请输入备注" class="layui-textarea">{$ConfigModel['remark']}</textarea>
					</div>
				</div>


				<div class="layui-form-item">
					<div class="layui-input-block">
						<input type="hidden" name="id" value="{$ConfigModel['id']}">
						<input type="hidden" name="config_type" value="text">
						<button class="layui-btn" lay-submit lay-filter="ajaxForm">立即提交</button>
						<button type="reset" class="layui-btn layui-btn-primary">重置</button>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>

<script type="text/javascript">


	layui.use(['form','layer','laydate'], function(){
  	var form = layui.form();
  	var laydate = layui.laydate;

		form.on('select(configType)', function(data){
			Main.config_type = data.value;
		});

		form.on('submit(ajaxForm)', function(data){
			var that = this;
			// $(that).attr("disabled","disabled");
			$.ajax({ 
				type: "post", 
				url: data.form.action, 
				data: data.field,
				dataType: 'json', 
				success: function(result){ 
					if(result['code'] == 1){
						layer.msg(result['msg']);
						window.setTimeout(function(){
							window.location.href = document.referrer;
						},800);
						
					}else{
						layer.msg(result['msg']);
						$(that).removeAttr("disabled");
					}
				} 
			});
			return false;
		});
	})

</script>
{/block}



		